{include file="common/head"/}
<div class="layui-fluid"><div class="layui-card"><div class="layui-card-body">
    <form class="layui-form layui-form-pane">     
        <fieldset class="layui-elem-field layui-field-title">
            <legend>修改部门管理员</legend>
        </fieldset> 

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">分类名称</label>
                <div class="layui-input-inline"style="width:250px">
                    <select name="classify_id" lay-verify="required" lay-filter="classify" id="">
                        <option value="">--请选择分类--</option>
                        {volist name="classifyList" id="vo"}
                        <option value="{$vo.id}" {eq name="$list1['classify_id']" value="$vo.id"}selected{/eq}>{$vo.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">部门名称</label>
                <div class="layui-input-inline"style="width:250px">
                    <select name="dept_id" id="deptSelect" lay-verify="" lay-filter="" id="">
                        {volist name="deptList" id="vo"}
                        <option value="{$vo.id}" {eq name="$list1['dept_id']" value="$vo.id"}selected{/eq}>{$vo.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-inline" style="width: 250px">
                <input type="text" name="tel" value="{$list1['tel']}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline" style="width: 250px">
                <input type="text" name="username" value="{$list1['username']}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
                <div class="layui-input-inline"style="width: 250px">
              <input type="password" name="password" placeholder="请输入密码" lay-verify="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">重复密码</label>
                <div class="layui-input-inline"style="width: 250px">
              <input type="password" name="repwd" placeholder="请输入密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
                <div class="layui-input-inline">
              <input type="radio" name="status" value="1" title="开启" {eq name="$list1['status']" value="1"}checked{/eq}>
              <input type="radio" name="status" value="0" title="关闭" {eq name="$list1['status']" value="0"}checked{/eq}>
            </div>
        </div>
        <input type="hidden" name="id" value="{$list1['id']}">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit1">{:lang('submit')}</button>
                <a href="{:url('index')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>


    </form>
</div>
</div>
</div>
{include file="common/foot"/}

<!-- <script src="__STATIC__/common/js/jquery.2.1.1.min.js"></script> -->
<script>
    layui.use(['form','upload'], function () {
        var form = layui.form,upload = layui.upload,$=layui.jquery;
        form.on('submit(submit1)', function (data) {
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("{:url('edit')}", data.field, function (res) {
                layer.close(loading);
                if (res.code > 0) {
                    layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                        location.href = res.url;
                    });
                } else {
                    layer.msg(res.msg, {time: 1800, icon: 2});
                }
            });
        });

        form.on('select(classify)', function(data) {
            $.getJSON("{:url('DeptManage/getDeptJoin')}&id=" + data.value, function(data) {
                if (data.code > 0) {
                    var optionstring = "";
                    $.each(data.data, function(i, item) {
                        optionstring += "<option value=\"" + item.id + "\" >" + item.name + "</option>";
                    });
                    $("#deptSelect").html(optionstring);
                    form.render('select');
                } else {
                    layer.msg(data.msg, { icon: 2 });
                }
            });
        });
       
    });
</script>